#!/usr/bin/python3
# -*- coding: utf-8 -*-

def trim(s):

    if len(s) <= 1:
        return s
    elif s[0] == ' ':
        s = s[1: ]
        return s
    elif s[-1] == ' ':
        s = s[: -1]
        return s
    else:
        return s

ss = " 1 2 3 "
# trim(ss)
print(trim(ss))
        
